package com.sky.mapper;

import com.sky.annotation.AutoFill;
import com.sky.entity.SetmealDish;
import com.sky.enumeration.OperationType;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {
    /*
    *根据菜品id来查询对应的套餐id
    *
    * */
   // @Select("SELECT * FROM setmeal_dish WHERE dish_id IN (1,2,3,4)")
    List<Long> getSetmealIdsByDishIds(List<Long> dishIds);


    /*
    * 根据套餐id删除套餐和菜品对应的关联关系
    * */
    @Delete("delete from setmeal_dish where setmeal_id = #{setmealId}")
    void deleteBySetmeal(Long setmealId);


    @Select("select * from setmeal_dish where setmeal_id =#{setmealId}")
    List<SetmealDish> getBySetmealId(Long setmealid);


    /*
    新增套餐
    * */
    @AutoFill(OperationType.INSERT)
    void insertBatch(List<SetmealDish> setmealDishes);
}
